package com.j2eefast.flowable.ui.api;

import com.j2eefast.common.core.controller.BaseController;
import com.j2eefast.flowable.bpm.entity.*;
import com.j2eefast.flowable.bpm.service.*;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;


@Controller
@RequestMapping("/formdata")
@Api("BPM前端接口")
@Slf4j
public class ApiGetFormDataPages extends BaseController {
    @Autowired
    private BpmBidReturnOfDepositService bpmBidReturnOfDepositService;
    @Autowired
    private BpmTaskFromService bpmTaskFromService;
    @Autowired
    private ProcdefService procdefService;
    @Autowired
    private FlowableCommentService flowableCommentService;
    @Autowired
    private BpmBidOtherService bidOtherService;
    @Autowired
    private BpmBidContractFormService bpmBidContractFormService;
    @Autowired
    private BpmBidSealFormService bpmBidSealFormService;
    @Autowired
    private BpmBidReportsFormService bpmBidReportsFormService;
    @Autowired
    private BpmBidLabourFormService bpmBidLabourFormService;
    @Autowired
    private BpmBidLegalPersonService bidLegalPersonService;
    @Autowired
    private BpmBidQualitySafetyCeHuiService bpmBidQualitySafetyCeHuiService;
    @Autowired
    private BpmBidQualitySafetyJianCeService bpmBidQualitySafetyJianCeService;
    @Autowired
    private BpmBidQualitySafetyKanChaService bpmBidQualitySafetyKanChaService;
    @Autowired
    private BpmBidQualitySafetyService bpmBidQualitySafetyService;
    @Autowired
    private BpmBidAcceptanceService bpmBidAcceptanceService;
    @Autowired
    private BpmBidLaborSettlementService bpmBidLaborSettlementService;
    @Autowired
    private BpmBidSettleableService bidSettleableService;
    @Autowired
    private BpmBidInvoiceFillService bpmBidInvoiceFillService;
    @Autowired
    private BpmBidInvoiceService bpmBidInvoiceService;
    @Autowired
    private BpmBidReportCeHuiService bpmBidReportCeHuiService;
    @Autowired
    private BpmBidReportDiHuanService bpmBidReportDiHuanService;
    @Autowired
    private BpmBidReportJianCeService bpmBidReportJianCeService;
    @Autowired
    private BpmBidReportKanChaService bpmBidReportKanChaService;
    @Autowired
    BpmBidOpeningFormService bpmBidOpeningFormService;
    @Autowired
    BpmBidDirectoryFormService bpmBidDirectoryFormService;
    @Autowired
    BpmBidAgencyFormService bpmBidAgencyFormService;

    //    保证金退回表单页面
    @RequestMapping("/returnofdeposit")
    @RequiresPermissions("bpm:bpmbidreturnofdeposit:add")
    public String returnofdeposit(@RequestParam(value = "taskId", required = true) String taskId,
                                  @RequestParam(value = "businessKey", required = true) String businessKey,
                                  ModelMap mmap) {
        String baseUrl = "modules/bpm/bpmbidreturnofdeposit";
        BpmBidReturnOfDepositEntity bpmOaForm = bpmBidReturnOfDepositService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    // 其他章盖章申请表单
    @GetMapping("/other")
    @RequiresPermissions("bpm:bidother:view")
    public String other(@RequestParam(value = "taskId", required = true) String taskId,
                        @RequestParam(value = "businessKey", required = true) String businessKey,
                        ModelMap mmap) {
        String baseUrl = "modules/bpm/bidother";
        BpmBidOtherEntity bpmBidOtherEntity = bidOtherService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidOtherEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidOtherEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidOtherEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    //合同盖章申请表
    @GetMapping("/contract")
    @RequiresPermissions("bpm:form:view")
    public String contract(@RequestParam(value = "taskId", required = true) String taskId,
                           @RequestParam(value = "businessKey", required = true) String businessKey,
                           ModelMap mmap) {
        String baseUrl = "modules/bpm/bidcontract";
        BpmBidContractEntity bpmOaForm = bpmBidContractFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    /**
     * 项目准备阶段相关文件盖章申请表
     */
    @GetMapping("/seal")
    @RequiresPermissions("bpm:form:view")
    public String seal(@RequestParam(value = "taskId", required = true) String taskId,
                       @RequestParam(value = "businessKey", required = true) String businessKey,
                       ModelMap mmap) {
        String baseUrl = "modules/bpm/bidseal";
        BpmBidSealEntity bpmOaForm = bpmBidSealFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    //    项目报备申请表
    @GetMapping("/reports")
    @RequiresPermissions("bpm:form:view")
    public String reports(@RequestParam(value = "taskId", required = true) String taskId,
                          @RequestParam(value = "businessKey", required = true) String businessKey,
                          ModelMap mmap) {

        String baseUrl = "modules/bpm/bidreports";

        BpmBidReportsEntity bpmOaForm = bpmBidReportsFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);

        mmap.put("taskId", taskId);

        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);

        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));

        return baseUrl + "/viewapp";
    }

    // 劳务、购销合同盖章申请表
    @GetMapping("/labour")
    @RequiresPermissions("bpm:form:view")
    public String labour(@RequestParam(value = "taskId", required = true) String taskId,
                         @RequestParam(value = "businessKey", required = true) String businessKey,
                         ModelMap mmap) {
        String baseUrl = "modules/bpm/bidlabour";
        BpmBidLabourEntity bpmOaForm = bpmBidLabourFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    // 法人章盖章申请表
    @GetMapping("/legalperson")
    @RequiresPermissions("bpm:form:view")
    public String legalperson(@RequestParam(value = "taskId", required = true) String taskId,
                              @RequestParam(value = "businessKey", required = true) String businessKey,
                              ModelMap mmap) {
        String baseUrl = "modules/bpm/bidlegalperson";
        BpmBidLegalPersonEntity bpmBidLegalPersonEntity = bidLegalPersonService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidLegalPersonEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidLegalPersonEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidLegalPersonEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    // 测绘公司项目质量安全监管表
    @GetMapping("/qualitysafetycehui")
    @RequiresPermissions("bpm:bidqualitysafetycehui:view")
    public String qualitysafetycehui(@RequestParam(value = "taskId", required = true) String taskId,
                                     @RequestParam(value = "businessKey", required = true) String businessKey,
                                     ModelMap mmap) {
        String baseUrl = "modules/bpm/bidqualitysafetycehui";
        BpmBidQualitySafetyCeHuiEntity bpmBidQualitySafetyCeHuiEntity = bpmBidQualitySafetyCeHuiService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidQualitySafetyCeHuiEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidQualitySafetyCeHuiEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidQualitySafetyCeHuiEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //    检测公司项目质量安全监管表
    @GetMapping("/qualitysafetyjiance")
    @RequiresPermissions("bpm:bidqualitysafetyjiance:view")
    public String qualitysafetyjiance(@RequestParam(value = "taskId", required = true) String taskId,
                                      @RequestParam(value = "businessKey", required = true) String businessKey,
                                      ModelMap mmap) {
        String baseUrl = "modules/bpm/bidqualitysafetyjiance";
        BpmBidQualitySafetyJianCeEntity bpmBidQualitySafetyJianCeEntity = bpmBidQualitySafetyJianCeService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidQualitySafetyJianCeEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidQualitySafetyJianCeEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidQualitySafetyJianCeEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    //勘察公司项目质量安全监管表
    @GetMapping("/qualitysafetykancha")
    @RequiresPermissions("bpm:bidqualitysafetykancha:view")
    public String qualitysafetykancha(@RequestParam(value = "taskId", required = true) String taskId,
                                      @RequestParam(value = "businessKey", required = true) String businessKey,
                                      ModelMap mmap) {
        String baseUrl = "modules/bpm/bidqualitysafetykancha";
        BpmBidQualitySafetyKanChaEntity bpmBidQualitySafetyKanChaEntity = bpmBidQualitySafetyKanChaService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidQualitySafetyKanChaEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidQualitySafetyKanChaEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidQualitySafetyKanChaEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //项目质量安全监管表
    @GetMapping("/qualitysafety")
    @RequiresPermissions("bpm:bidqualitysafety:view")
    public String qualitysafety(@RequestParam(value = "taskId", required = true) String taskId,
                                @RequestParam(value = "businessKey", required = true) String businessKey,
                                ModelMap mmap) {
        String baseUrl = "modules/bpm/bidqualitysafety";
        BpmBidQualitySafetyEntity bpmBidQualitySafetyEntity = bpmBidQualitySafetyService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidQualitySafetyEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidQualitySafetyEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidQualitySafetyEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //
    @GetMapping("/acceptance")
    @RequiresPermissions("bpm:bidacceptance:view")
    public String acceptance(@RequestParam(value = "taskId", required = true) String taskId,
                             @RequestParam(value = "businessKey", required = true) String businessKey,
                             ModelMap mmap) {
        String baseUrl = "modules/bpm/bidacceptance";
        BpmBidAcceptanceEntity bpmBidAcceptanceEntity = bpmBidAcceptanceService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidAcceptanceEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidAcceptanceEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidAcceptanceEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    //劳务费结算单
    @GetMapping("/laborsettlement")
    @RequiresPermissions("bpm:bidlaborsettlement:view")
    public String laborsettlement(@RequestParam(value = "taskId", required = true) String taskId,
                                  @RequestParam(value = "businessKey", required = true) String businessKey,
                                  ModelMap mmap) {
        String baseUrl = "modules/bpm/bidlaborsettlement";
        BpmBidLaborSettlementEntity BpmBidLaborSettlementEntity = bpmBidLaborSettlementService.getFormById(businessKey);
        mmap.put("bpmForm", BpmBidLaborSettlementEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(BpmBidLaborSettlementEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(BpmBidLaborSettlementEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //可结算金额
    @GetMapping("/settleable")
    @RequiresPermissions("bpm:bidsettleable:view")
    public String settleable(@RequestParam(value = "taskId", required = true) String taskId,
                             @RequestParam(value = "businessKey", required = true) String businessKey,
                             ModelMap mmap) {
        String baseUrl = "modules/bpm/bidsettleable";
        BpmBidSettleableEntity bpmBidSettleableEntity = bidSettleableService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidSettleableEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidSettleableEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidSettleableEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //补开具发票申请表
    @GetMapping("/invoicefill")
    @RequiresPermissions("bpm:bidinvoicefill:view")
    public String invoicefill(@RequestParam(value = "taskId", required = true) String taskId,
                              @RequestParam(value = "businessKey", required = true) String businessKey,
                              ModelMap mmap) {
        String baseUrl = "modules/bpm/bidinvoicefill";
        BpmBidInvoiceFillEntity bpmBidInvoiceFillEntity = bpmBidInvoiceFillService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidInvoiceFillEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidInvoiceFillEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidInvoiceFillEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //开具发票申请表
    @GetMapping("/invoice")
    @RequiresPermissions("bpm:bidinvoice:view")
    public String invoice(@RequestParam(value = "taskId", required = true) String taskId,
                          @RequestParam(value = "businessKey", required = true) String businessKey,
                          ModelMap mmap) {
        String baseUrl = "modules/bpm/bidinvoice";
        BpmBidInvoiceEntity bpmBidInvoiceEntity = bpmBidInvoiceService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidInvoiceEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidInvoiceEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidInvoiceEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //测绘公司成果报告盖章申请表
    @GetMapping("/reportcehui")
    @RequiresPermissions("bpm:bidreportcehui:view")
    public String reportcehui(@RequestParam(value = "taskId", required = true) String taskId,
                              @RequestParam(value = "businessKey", required = true) String businessKey,
                              ModelMap mmap) {
        String baseUrl = "modules/bpm/bidreportcehui";
        BpmBidReportsCeHuiEntity bpmBidReportsCeHuiEntity = bpmBidReportCeHuiService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidReportsCeHuiEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidReportsCeHuiEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidReportsCeHuiEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //地环公司成果报告盖章申请表
    @GetMapping("/reportdihuan")
    @RequiresPermissions("bpm:bidreportdihuan:view")
    public String reportdihuan(@RequestParam(value = "taskId", required = true) String taskId,
                               @RequestParam(value = "businessKey", required = true) String businessKey,
                               ModelMap mmap) {
        String baseUrl = "modules/bpm/bidreportdihuan";
        BpmBidReportsDiHuanEntity bpmBidReportsDiHuanEntity = bpmBidReportDiHuanService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidReportsDiHuanEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidReportsDiHuanEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidReportsDiHuanEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //检测公司成果报告盖章申请表
    @GetMapping("/reportjiance")
    @RequiresPermissions("bpm:bidreportjiance:view")
    public String reportjiance(@RequestParam(value = "taskId", required = true) String taskId,
                               @RequestParam(value = "businessKey", required = true) String businessKey,
                               ModelMap mmap) {
        String baseUrl = "modules/bpm/bidreportjiance";
        BpmBidReportsJianCeEntity bpmBidReportsJianCeEntity = bpmBidReportJianCeService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidReportsJianCeEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidReportsJianCeEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidReportsJianCeEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    //勘察公司成果报告盖章申请表
    @GetMapping("/reportkancha")
    @RequiresPermissions("bpm:bidreportkancha:view")
    public String reportkancha(@RequestParam(value = "taskId", required = true) String taskId,
                               @RequestParam(value = "businessKey", required = true) String businessKey,
                               ModelMap mmap) {
        String baseUrl = "modules/bpm/bidreportkancha";
        BpmBidReportsKanChaEntity bpmBidReportsKanChaEntity = bpmBidReportKanChaService.getFormById(businessKey);
        mmap.put("bpmForm", bpmBidReportsKanChaEntity);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmBidReportsKanChaEntity.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmBidReportsKanChaEntity.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }


    @GetMapping("/opening")
    @RequiresPermissions("bpm:bidopening:view")
    public String opening(@RequestParam(value = "taskId", required = true) String taskId,
                          @RequestParam(value = "businessKey", required = true) String businessKey,
                          ModelMap mmap) {
        String baseUrl = "modules/bpm/bidopening";
        BpmBidOpeningEntity bpmOaForm = bpmBidOpeningFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    @GetMapping("/directory")
    @RequiresPermissions("bpm:biddirectory:view")
    public String directory(@RequestParam(value="taskId", required=true)String taskId,
                       @RequestParam(value="businessKey", required=true)String businessKey,
                       ModelMap mmap){
        String baseUrl="modules/bpm/biddirectory";
        BpmBidDirectoryEntity bpmOaForm = bpmBidDirectoryFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }

    @GetMapping("/agency")
    @RequiresPermissions("bpm:bidagency:view")
    public String agency(@RequestParam(value="taskId", required=true)String taskId,
                       @RequestParam(value="businessKey", required=true)String businessKey,
                       ModelMap mmap){
        String baseUrl= "modules/bpm/bidagency";
        BpmBidAgencyEntity bpmOaForm = bpmBidAgencyFormService.getFormById(businessKey);
        mmap.put("bpmForm", bpmOaForm);
        mmap.put("taskId", taskId);
        BpmTaskFromEntity bpmTaskFrom = bpmTaskFromService.getById(bpmOaForm.getFormId());
        mmap.put("bpmTaskFrom", bpmTaskFrom);
        BpmProcessDefinitionEntity proDef = procdefService.getById(bpmTaskFrom.getProcessDefinitionKey());
        mmap.put("proDef", proDef);
        mmap.put("comment", flowableCommentService.getFlowCommentVosByProcessInstanceId(bpmOaForm.getProcessInstanceId()));
        return baseUrl + "/viewapp";
    }



}

